#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:homework4_1.py
# author:wmf
# datetime:2021/4/11 16:37
# software: PyCharm
'''
this is function description
'''
# import module your need

# 1 定义一个10个元素的列表，通过列表自带的函数，实现元素在尾部插入和头部插入并记录程序运行的时间；用deque来实现，同样记录程序所耗费的时间；输出这2个时间的差值；
#     提示：列表原生的函数实现头部插入数据：list.insert(0, v)；list.append（2）)

import time
from collections import deque

# 列表自带函数实行插入
num = []

num.insert(0,time.time())

for x in range(0,10):
    num.insert(x+1,x)

num.append(time.time())

time1 = num[11] - num[0]

# deque实现插入
d = deque()

d.append(time.time())

for x in range(0,10):
    d.append(x)

d.extend([time.time()])

time2 = d[11] - d[0]

print(time2 - time1)